package net.servir.censo.web.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import net.servir.censo.model.CapValidacion;
import net.servir.censo.model.Censo;
import net.servir.censo.service.CensoService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class InicioController {

	@Autowired
	private CensoService censoService;
	@RequestMapping("/inicio.htm")
	public @ModelAttribute("censo")
	CapValidacion censo(HttpServletRequest request) {
		CapValidacion obj = new CapValidacion();
		HttpSession session = request.getSession();
		String cod_session =session.getId();
		obj.setCod_session(cod_session);
		obj.setCaps();
		session.setAttribute("finalizar", "0");	
		session.setAttribute("idsesion_serv", session.getId().toString());
		session.setAttribute("captcha_serv", obj.getCap1() + obj.getCap2());
		return obj;
	}
}
